function child(){
	

	
	
//该方法相当于入口函数，进入该子页面即执行
}





//加载房间类型选项
function loadRoomTypeSelect(){
	$.ajax({
		url:"../../roomtype/all",
		type:"get",
		dataType:"json",
		success:function(data){
			//为房间类型添加选项
			var selectItems = "";
			selectItems += '<option value="0"></option></br>';
			for (var i = 0; i < data.length; i++) {
				var roomtype = data[i];
				
				selectItems += '<option value="'+roomtype.roomtype_id+'">'+roomtype.type+'</option></br>';
				
				
			}
			
			$("#roomtype_id").html(selectItems);
		}

		
		
		
	});
}
loadRoomTypeSelect();








function roomId() {
	
	var roomtype_id = $('select  option:selected').val();
	$.ajax({
		url:"../../room/selectItem",
		type:"post",
		dataType:"json",
		data:{
			"roomtype_id":roomtype_id
		},
		success:function(data){
			//为房间类型添加选项
			var selectItems = "";
			selectItems += '<option value="0"></option></br>';
			for (var i = 0; i < data.length; i++) {
				var room = data[i];
				
				selectItems += '<option value="'+room.room_id+'">'+room.roomnum+'</option></br>';
				
				
			}
			
			$("#room_id").html(selectItems);
		}

		
		
		
	});
}

function updateRoomCut(){
	$.ajax({
		url:"../../room/updateCut",
		type:"post",
		dataType:"json",
		
		data:{
			"roomtype_id":$("#roomtype_id").val(),
			"room_id":$("#room_id").val(),
			"cut":$("#cut").val()
		},
		success:function(data){
			
			if(data==0){
				alert("修改失败");
				parent.layer.closeAll();//关闭所有的弹窗
				 parent.location.reload();
			}else{
				
				parent.layer.closeAll();//关闭所有的弹窗
				 parent.location.reload();
			}
			
			
			
		}
	});
}


